package kr.hkit.powerjava.chapter21.work;

class BankAccount {
	int balance;

	void deposit(int amount) {
		balance += amount;
	}

	void withdraw(int amount) throws MyException {
		balance -= amount;
		if (balance < 0) {
			throw new MyException();
		}
	}

	int getBalance() throws MyException {
		double eja = (balance * 0.075) + balance;
		if (balance < 0) {
			throw new MyException();
		} else {

			System.out.println(balance + "원");
			System.out.println("예상이자 포함 값 : " + (int) eja + "원");
		}
		return balance;
	}

}

public class programming4 { // class BankAccountTest 대용
	public static void main(String[] args) {

		BankAccount b = new BankAccount();
		b.deposit(60);
		try {
			b.withdraw(100);
		} catch (MyException e) {
			System.out.println(e.getMessage());
			e.printStackTrace();
		}
	}

}
